import time
from time import sleep
from selenium.webdriver.support.select import Select
from Finance_fun.base.base import Base
from Finance_fun import page


class Page_My_Investment(Base):
    """以下为我的投资界面操作"""

    # 点击我的投资
    def my_tz(self):
        self.base_click(page.my_tz)

    # 点击投标中
    def tbz(self):
        self.base_click(page.tbz_link)

    # 点击已结清
    def yjq(self):
        self.base_click(page.yjq_link)

    # 点击已流标
    def ylb(self):
        self.base_click(page.ylb_link)

    # 选择开始日期
    def check_start_date(self, start_date):
        self.base_input(page.start_date1, start_date)

    # 选择结束日期
    def check_end_date(self, end_date):
        # self.base_click(page.end_date)
        self.base_input(page.end_date, end_date)

    # 点击筛选按钮
    def click_filter_btn(self):
        self.base_click(page.filter_btn)

    # 封装筛选操作
    def filter(self, starttime, endtime):
        self.check_start_date(starttime)
        self.check_end_date(endtime)
        self.click_filter_btn()

    # 点击登录链接
    def page_click_login_link(self):
        self.base_click(page.login_link)

    # 输入登录手机号
    def page_input_login_phone(self, phone):
        self.base_input(page.login_phone, phone)

    # 输入登录密码
    def page_input_login_password(self, password):
        self.base_input(page.login_password, password)

    # 点击登录按钮
    def page_click_login_btn(self):
        self.base_click(page.login_btn)

    # 集成登录操作
    def page_login(self, phone, password):
        self.page_input_login_phone(phone)
        self.page_input_login_password(password)
        self.page_click_login_btn()
        sleep(1)

